package net.zoneland.knowledge.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

import net.zoneland.knowledge.model.QaSatisfaction;
import net.zoneland.knowledge.model.QaSatisfactionExample;

@Mapper
public interface QaSatisfactionMapper {
    @SelectProvider(type=QaSatisfactionSqlProvider.class, method="countByExample")
    long countByExample(QaSatisfactionExample example);

    @Delete({
        "delete from AITK_QA_SATISFACTION",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into AITK_QA_SATISFACTION (ID, QUENAME, ",
        "REQID, REQNAME, ",
        "CMPDN, DEPTDN, STATUS, ",
        "CREATETIME, SESSIONID)",
        "values (#{id,jdbcType=VARCHAR}, #{queName,jdbcType=VARCHAR}, ",
        "#{reqId,jdbcType=VARCHAR}, #{reqName,jdbcType=VARCHAR}, ",
        "#{cmpDn,jdbcType=VARCHAR}, #{deptDn,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{sessionId,jdbcType=VARCHAR})"
    })
    int insert(QaSatisfaction record);

    @InsertProvider(type=QaSatisfactionSqlProvider.class, method="insertSelective")
    int insertSelective(QaSatisfaction record);

    @SelectProvider(type=QaSatisfactionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="QUENAME", property="queName", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQID", property="reqId", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQNAME", property="reqName", jdbcType=JdbcType.VARCHAR),
        @Result(column="CMPDN", property="cmpDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTDN", property="deptDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="STATUS", property="status", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="SESSIONID", property="sessionId", jdbcType=JdbcType.VARCHAR)
    })
    List<QaSatisfaction> selectByExample(QaSatisfactionExample example);

    @Select({
        "select",
        "ID, QUENAME, REQID, REQNAME, CMPDN, DEPTDN, STATUS, CREATETIME, SESSIONID",
        "from AITK_QA_SATISFACTION",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="QUENAME", property="queName", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQID", property="reqId", jdbcType=JdbcType.VARCHAR),
        @Result(column="REQNAME", property="reqName", jdbcType=JdbcType.VARCHAR),
        @Result(column="CMPDN", property="cmpDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="DEPTDN", property="deptDn", jdbcType=JdbcType.VARCHAR),
        @Result(column="STATUS", property="status", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATETIME", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="SESSIONID", property="sessionId", jdbcType=JdbcType.VARCHAR)
    })
    QaSatisfaction selectByPrimaryKey(String id);

    @UpdateProvider(type=QaSatisfactionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") QaSatisfaction record, @Param("example") QaSatisfactionExample example);

    @UpdateProvider(type=QaSatisfactionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") QaSatisfaction record, @Param("example") QaSatisfactionExample example);

    @UpdateProvider(type=QaSatisfactionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(QaSatisfaction record);

    @Update({
        "update AITK_QA_SATISFACTION",
        "set QUENAME = #{queName,jdbcType=VARCHAR},",
          "REQID = #{reqId,jdbcType=VARCHAR},",
          "REQNAME = #{reqName,jdbcType=VARCHAR},",
          "CMPDN = #{cmpDn,jdbcType=VARCHAR},",
          "DEPTDN = #{deptDn,jdbcType=VARCHAR},",
          "STATUS = #{status,jdbcType=VARCHAR},",
          "CREATETIME = #{createTime,jdbcType=TIMESTAMP},",
          "SESSIONID = #{sessionId,jdbcType=VARCHAR},",
          "HANDLER_UID = #{handlerUid,jdbcType=VARCHAR},",
          "HANDLER_NAME = #{handlerName,jdbcType=VARCHAR}",
        "where ID = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(QaSatisfaction record);
}
